<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <title>搜索页面</title>

    <link href="/static/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css"/>
    <link href="/static/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css"/>

    <link href="/static/basic/css/demo.css" rel="stylesheet" type="text/css"/>

    <link href="/static/css/seastyle.css" rel="stylesheet" type="text/css"/>

    <script type="text/javascript" src="/static/basic/js/jquery-1.7.min.js"></script>
    <script type="text/javascript" src="/static/js/script.js"></script>
    <style type="text/css">
        a {
            cursor: pointer;
        }
    </style>
</head>


<body>

<!--顶部导航条 -->
<div class="am-container header">
    <ul class="message-l">
        <div class="topMessage">
            <div class="menu-hd">
                <a href="#" target="_top" class="h">亲，请登录</a>
                <a href="#" target="_top">免费注册</a>
            </div>
        </div>
    </ul>
    <ul class="message-r">
        <div class="topMessage home">
            <div class="menu-hd"><a href="http://msmall.com" target="_top" class="h">首页</a></div>
        </div>
        <div class="topMessage my-shangcheng">
            <div class="menu-hd MyShangcheng"><a href="#" target="_top"><i class="am-icon-user am-icon-fw"></i>个人中心</a>
            </div>
        </div>
        <div class="topMessage mini-cart">
            <div class="menu-hd"><a id="mc-menu-hd" href="#" target="_top"><i
                    class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span><strong id="J_MiniCartNum"
                                                                                          class="h">0</strong></a></div>
        </div>
        <div class="topMessage favorite">
            <div class="menu-hd"><a href="http://order.msmall.com/orderlist.html" target="_top"><i class="am-icon-heart am-icon-fw"></i><span>我的订单</span></a>
            </div>
    </ul>
</div>

<!--悬浮搜索框-->

<div class="nav white">
    <div class="logo"><img src="/static/images/logo.png"/></div>
    <div class="logoBig">
        <li><img src="/static/images/logobig.png"/></li>
    </div>

    <div class="search-bar pr">
        <a name="index_none_header_sysc" href="#"></a>
        <form th:with="k=${param.keyword}">
            <input id="searchInput" th:value="${k}" type="text" placeholder="搜索" autocomplete="off">
            <!--<input id="" class="" value="搜索" index="1" type="submit">-->
            <a href="javascript:searchBykeyword()" class="submit am-btn" id="ai-topsearch">搜索</a>
        </form>
    </div>
</div>

<div class="clear"></div>
<b class="line"></b>
<div class="search">
    <div class="search-list">
        <div class="nav-table">
            <div class="long-title"><span class="all-goods">全部分类</span></div>
            <div class="nav-cont">
                <ul>
                    <li class="index"><a href="#">首页</a></li>
                    <li class="qc"><a href="#">闪购</a></li>
                    <li class="qc"><a href="#">限时抢</a></li>
                    <li class="qc"><a href="#">团购</a></li>
                    <li class="qc last"><a href="#">大包装</a></li>
                </ul>
                <div class="nav-extra">
                    <i class="am-icon-user-secret am-icon-md nav-user"></i><b></b>我的福利
                    <i class="am-icon-angle-right" style="padding-left: 10px;"></i>
                </div>
            </div>
        </div>


        <div class="am-g am-g-fixed">
            <div class="am-u-sm-12 am-u-md-12">
                <div class="theme-popover">
                    <div class="searchAbout" th:if="${result!=null}">
                        <span class="font-pale">全部结果：</span>
                        <a href="#"></a>
                    </div>
                    <ul class="select" th:if="${result!=null}">
                        <p class="title font-normal">
                            <span class="fl">结果</span>
                            <span class="total fl">搜索到<strong class="num">997</strong>件相关商品</span>
                        </p>
                        <div class="clear"></div>
                        <li class="select-result">
                            <dl>
                                <dt>已选</dt>
                                <dd class="select-no"></dd>
                                <p class="eliminateCriteria">清除</p>
                            </dl>
                        </li>
                        <div class="clear"></div>
                        <li class="select-list">
                            <dl id="select1">
                                <dt class="am-badge am-round">品牌</dt>

                                <div class="dd-conent" style="height: 50px;">
                                    <dd class="select-all" th:each="brand : ${result.brands}" style="height: 40px;">
                                        <a href="#" th:if="${!#strings.isEmpty(brand.brandImg)}">
                                            <img class="" th:src="${brand.brandImg}" alt=""/>
                                        </a>
                                        <a href="#" th:if="${#strings.isEmpty(brand.brandImg)}" style="height: 50px;">
                                            <span th:text="${brand.brandName}"></span>
                                        </a>
                                    </dd>
                                    <!--<dd><a href="#">百草味</a></dd>-->

                                </div>

                            </dl>
                        </li>
                        <li class="select-list">
                            <dl id="select2">
                                <dt class="am-badge am-round">分类</dt>
                                <div class="dd-conent">
                                    <dd class="select-all selected" th:each="catelog : ${result.catalogs}">
                                        <a href="#" th:text="${catelog.catelogName}">全部</a>
                                    </dd>
                                </div>
                            </dl>
                        </li>
                        <li class="select-list" th:each="attr : ${result.attrVos}">
                            <dl id="select3">
                                <dt class="am-badge am-round" th:text="${attr.attrName}">选购热点</dt>
                                <div class="dd-conent">
                                    <dd class="select-all selected" th:each="attrVal : ${attr.attrValue}">
                                        <a href="#" th:text="${attrVal}">全部</a>
                                    </dd>

                                </div>
                            </dl>
                        </li>

                    </ul>
                    <ul class="select" th:if="${result==null}">
                        <div>没有检索到相关结果</div>
                    </ul>
                    <div class="clear"></div>
                </div>
                <div class="search-content" style="width: 100%;">
                    <div class="sort"  th:with="p=${param.sort},price=${param.skuPrice}">
                        <li th:class="${(!#strings.isEmpty(p) && #strings.startsWith(p,'hotScore'))?'first':''}">
                            <a title="综合" th:class="${(!#strings.isEmpty(p) && #strings.equals(p,'hotScore_desc'))?'sort_a desc':'sort_a'}" sort="hotScore">综合排序
                                <i th:class="${(!#strings.isEmpty(p) && #strings.equals(p,'hotScore_asc'))?'am-icon-long-arrow-up':'am-icon-long-arrow-down'}"></i>
                            </a>
                        </i>

                        <li>
                            <a title="销量" sort="saleCount" class="">销量排序
                                <i class="am-icon-long-arrow-down"></i>
                            </a>
                        </li>
                        <li th:class="${(!#strings.isEmpty(p) && #strings.startsWith(p,'skuPrice'))?'first':''}">
                            <a title="价格" th:class="${(!#strings.isEmpty(p) && #strings.equals(p,'skuPrice_desc'))?'sort_a desc':'sort_a'}" sort="skuPrice">价格排序
                                <i th:class="${(!#strings.isEmpty(p) && #strings.equals(p,'skuPrice_asc'))?'am-icon-long-arrow-up':'am-icon-long-arrow-down'}"></i>
                            </a>
                        </li>
                        <!--<li class="big"><a title="评价" href="#">评价为主</a></li>-->
                        <li>
                            <div class="am-input-group-sm">
                                <input id="skuPriceFrom" class="am-form-field"  th:value="${#strings.substringBefore(price,'_')}" type="text" style="font-size: 12px!important;width: 55.3px;height: 50%;padding: 5px;display: inline">-
                                <input id="skuPriceTo" class="am-form-field"  th:value="${#strings.substringAfter(price,'_')}"  type="text" style="font-size: 12px!important;width: 55.3px;height: 50%;padding: 5px;display: inline">
                                    <button id="skuPriceSearchBtn" class="am-btn am-btn-sm" type="button">
                                        <span class="am-icon-search"></span>
                                    </button>

                            </div>
                        </li>
                        <li>
                            <div class="am-checkbox">
                            <label th:with="stock=${param.hasStock}">
                                <input type="checkbox" id="storage"   th:checked="${#strings.equals(stock, '1')}"> 仅显示有货
                            </label>
                            </div>
                        </li>

                    </div>
                    <div class="clear"></div>

                    <ul class="am-avg-sm-2 am-avg-md-3 am-avg-lg-4 boxes" th:if="${result!=null}">

                        <li th:each="sku : ${result.skuModels}">
                            <div class="i-pic limit">

                                <a th:href="|http://item.msmall.com/${sku.skuId}.html|">
                                    <img src="/static/images/imgsearch1.jpg" th:src="${sku.skuImg}"/>
                                </a>
                                <p class="title fl">
                                    <a th:href="|http://item.msmall.com/${sku.skuId}.html|" th:utext="${sku.skuTitle}"></a>
                                </p>
                                <p class="price fl">
                                    <b>¥</b>
                                    <strong th:text="${sku.skuPrice}">56.90</strong>
                                </p>
                                <p class="number fl">
                                  是否有货：<span th:text="${sku.hasStock}?'有':'无'">1110</span>
                                </p>
                            </div>
                        </li>
                    </ul>
                </div>

                <div class="clear"></div>
                <!--分页 -->
                <ul class="am-pagination am-pagination-right" th:if="${result!=null}">
                    <li th:class="${result.currentPage>1?'':'am-disabled'}">
                        <a class="page_a"  th:attr="pn=${result.currentPage - 1}">&laquo;</a>
                    </li>
                    <li th:each="pn : ${result.pageNavs}"  th:class="${(result.currentPage == pn)?'am-active':''}">
                        <a class="page_a" th:attr="pn=${pn}">[[${pn}]]</a>
                    </li>

                    <li th:class="${result.currentPage<result.totalPages?'':'am-disabled'}">
                        <a class="page_a" th:attr="pn=${result.currentPage + 1}">&raquo;</a>
                    </li>
                </ul>

            </div>
        </div>
        <div class="footer">
            <div class="footer-hd">
                <p>
                    <a href="#">恒望科技</a>
                    <b>|</b>
                    <a href="#">商城首页</a>
                    <b>|</b>
                    <a href="#">支付宝</a>
                    <b>|</b>
                    <a href="#">物流</a>
                </p>
            </div>
            <div class="footer-bd">
                <p>
                    <a href="#">关于恒望</a>
                    <a href="#">合作伙伴</a>
                    <a href="#">联系我们</a>
                    <a href="#">网站地图</a>
                    <em>© 2021-2025 Hengwang.com 版权所有</em>
                </p>
            </div>
        </div>
    </div>

</div>

<!--引导 -->
<div class="navCir">
    <li><a href="home.html"><i class="am-icon-home "></i>首页</a></li>
    <li><a href="sort.html"><i class="am-icon-list"></i>分类</a></li>
    <li><a href="shopcart.html"><i class="am-icon-shopping-basket"></i>购物车</a></li>
    <li><a href="/static/person/index.html"><i class="am-icon-user"></i>我的</a></li>
</div>

<!--菜单 -->
<div class=tip>
    <div id="sidebar">
        <div id="wrap">
            <div id="prof" class="item">
                <a href="#">
                    <span class="setting"></span>
                </a>
                <div class="ibar_login_box status_login">
                    <div class="avatar_box">
                        <p class="avatar_imgbox"><img src="/static/images/no-img_mid_.jpg"/></p>
                        <ul class="user_info">
                            <li>用户名：sl1903</li>
                            <li>级&nbsp;别：普通会员</li>
                        </ul>
                    </div>
                    <div class="login_btnbox">
                        <a href="#" class="login_order">我的订单</a>
                        <a href="#" class="login_favorite">我的收藏</a>
                    </div>
                    <i class="icon_arrow_white"></i>
                </div>

            </div>
            <div id="shopCart" class="item">
                <a href="#">
                    <span class="message"></span>
                </a>
                <p>
                    购物车
                </p>
                <p class="cart_num">0</p>
            </div>
            <div id="asset" class="item">
                <a href="#">
                    <span class="view"></span>
                </a>
                <div class="mp_tooltip">
                    我的资产
                    <i class="icon_arrow_right_black"></i>
                </div>
            </div>

            <div id="foot" class="item">
                <a href="#">
                    <span class="zuji"></span>
                </a>
                <div class="mp_tooltip">
                    我的足迹
                    <i class="icon_arrow_right_black"></i>
                </div>
            </div>

            <div id="brand" class="item">
                <a href="#">
                    <span class="wdsc"><img src="/static/images/wdsc.png"/></span>
                </a>
                <div class="mp_tooltip">
                    我的收藏
                    <i class="icon_arrow_right_black"></i>
                </div>
            </div>

            <div id="broadcast" class="item">
                <a href="#">
                    <span class="chongzhi"><img src="/static/images/chongzhi.png"/></span>
                </a>
                <div class="mp_tooltip">
                    我要充值
                    <i class="icon_arrow_right_black"></i>
                </div>
            </div>

            <div class="quick_toggle">
                <li class="qtitem">
                    <a href="#"><span class="kfzx"></span></a>
                    <div class="mp_tooltip">客服中心<i class="icon_arrow_right_black"></i></div>
                </li>
                <!--二维码 -->
                <li class="qtitem">
                    <a href="#none"><span class="mpbtn_qrcode"></span></a>
                    <div class="mp_qrcode" style="display:none;"><img src="/static/images/weixin_code_145.png"/><i
                            class="icon_arrow_white"></i></div>
                </li>
                <li class="qtitem">
                    <a href="#top" class="return_top"><span class="top"></span></a>
                </li>
            </div>

            <!--回到顶部 -->
            <div id="quick_links_pop" class="quick_links_pop hide"></div>

        </div>

    </div>
    <div id="prof-content" class="nav-content">
        <div class="nav-con-close">
            <i class="am-icon-angle-right am-icon-fw"></i>
        </div>
        <div>
            我
        </div>
    </div>
    <div id="shopCart-content" class="nav-content">
        <div class="nav-con-close">
            <i class="am-icon-angle-right am-icon-fw"></i>
        </div>
        <div>
            购物车
        </div>
    </div>
    <div id="asset-content" class="nav-content">
        <div class="nav-con-close">
            <i class="am-icon-angle-right am-icon-fw"></i>
        </div>
        <div>
            资产
        </div>

        <div class="ia-head-list">
            <a href="#" target="_blank" class="pl">
                <div class="num">0</div>
                <div class="text">优惠券</div>
            </a>
            <a href="#" target="_blank" class="pl">
                <div class="num">0</div>
                <div class="text">红包</div>
            </a>
            <a href="#" target="_blank" class="pl money">
                <div class="num">￥0</div>
                <div class="text">余额</div>
            </a>
        </div>

    </div>
    <div id="foot-content" class="nav-content">
        <div class="nav-con-close">
            <i class="am-icon-angle-right am-icon-fw"></i>
        </div>
        <div>
            足迹
        </div>
    </div>
    <div id="brand-content" class="nav-content">
        <div class="nav-con-close">
            <i class="am-icon-angle-right am-icon-fw"></i>
        </div>
        <div>
            收藏
        </div>
    </div>
    <div id="broadcast-content" class="nav-content">
        <div class="nav-con-close">
            <i class="am-icon-angle-right am-icon-fw"></i>
        </div>
        <div>
            充值
        </div>
    </div>
</div>

<script type="text/javascript" src="/static/basic/js/quick_links.js"></script>

<div class="theme-popover-mask"></div>

</body>

<script>
    window.jQuery || document.write('<script src="/static/basic/js/jquery-1.9.min.js"><\/script>');

    //是否有库存
    $("#storage").change(function () {
        location.href = replaceAndAddParamVal(location.href, "hasStock", $(this).prop("checked") ? '1' : '0');
    });

    //全文搜索
    function searchBykeyword() {
        location.href = replaceAndAddParamVal(location.href, "keyword", $("#searchInput").val(), false);
    }

    //价格区间搜索
    $("#skuPriceSearchBtn").click(function () {
        var from = $("#skuPriceFrom").val();
        var to = $("#skuPriceTo").val();
        location.href = replaceAndAddParamVal(location.href, "priceRange", from + '_' + to);

    });

    //跳转分页
    $(".page_a").click(function () {

        var pageNum = $(this).attr("pn");
        location.href = replaceAndAddParamVal(location.href, "pageNum", pageNum);
        return false;
    });

    //排序
    $(".sort_a").click(function () {
        //改变yangshi
//        changeStyle(this);
        $(this).toggleClass("desc");
//        console.log($(this).attr("sort")=='skuPrice');
//        if ($(this).attr("sort")=='skuPrice'){
//            $("a[sort='hotScore']").attr("class","sort_a");
//        }else{
//            $("a[sort='skuPrice']").attr("class","sort_a");
//        }


//        $(this).
        //跳转指定排序规则
        //排序规则hotScore_desc/asc)，销量(saleCount_desc/asc)，价格(skuPrice_desc/asc)
        if ($(this).hasClass("desc")) {
            location.href = replaceAndAddParamVal(location.href, "sort", $(this).attr("sort") + "_desc");
        } else {
            location.href = replaceAndAddParamVal(location.href, "sort", $(this).attr("sort") + "_asc");
        }

        return false;
    });

    //向url中添加或者删除参数
    function replaceAndAddParamVal(url, paramName, replaceVal, forceAdd) {
        //去掉没用#
        url=url.replace(/#/,'');
        var oUrl = url.toString();
        if (oUrl.indexOf(paramName) != -1) {
            console.log("匹配成功。。。")
            if (forceAdd) {

                oUrl = decodeURIComponent(oUrl);
                var str = new RegExp(paramName + '=' + replaceVal);
//                alert(str.test(oUrl));
                if (!str.test(oUrl)) {

                    //判断是否强制添加
                    var nUrl = "";
                    //没有就添加
                    if (oUrl.indexOf("?") != -1) {
                        //有？
                        nUrl = oUrl + "&" + paramName + '=' + replaceVal

                    } else {
                        nUrl = oUrl + "?" + paramName + '=' + replaceVal
                    }
                    return nUrl;
                } else {
//                    alert("有相同的参数和值");
                    return oUrl;
                }

            } else {
                //有就替换
                var re = eval('/(' + paramName + '=)([^&]*)/gi');
                //将匹配正则的字符串替换成新的
                var nUrl = oUrl.replace(re, paramName + '=' + replaceVal);

                return nUrl;
            }

        } else {
            var nUrl = "";
            //没有就添加
            if (oUrl.indexOf("?") != -1) {
                //有？
                nUrl = oUrl + "&" + paramName + '=' + replaceVal

            } else {
                nUrl = oUrl + "?" + paramName + '=' + replaceVal
            }
            return nUrl;

        }


    }

</script>

</html>